package com.emns.service.mobile;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.emns.dao.YueduScoreMapper;
import com.emns.pojo.YueduScore;
import com.emns.pojo.YueduScoreExample;

@Service
public class YueduScoreMobileService {

	@Autowired
	YueduScoreMapper ysm;

	public int addYueduScore(YueduScore ys) {
		int flag = 0;
		YueduScoreExample yse = new YueduScoreExample();
		yse.createCriteria().andTYueduYueduIdEqualTo(ys.gettYueduYueduId())
				.andTUserUserIdEqualTo(ys.gettUserUserId());
		if (ysm.selectByExample(yse).size() > 0) {
			flag = 405;
		} else {
			int count = ysm.insert(ys);
			if (count > 0) {
				flag = 200;
			} else {
				flag = 1;
			}
		}

		return flag;
	}
}
